package nowCoder;

import java.util.*;

public class HJ27 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        String[] x = new String[a];
        for(int i = 0; i<a; i++){
            x[i] = in.next();
        }
        String y = in.next();
        int b = in.nextInt();

        ArrayList<String> l = new ArrayList<>();
        Map<Character , Integer> yy = new HashMap<>();
        for (char c : y.toCharArray()) {
            yy.put(c,yy.get(c) == null?1:yy.get(c)+1);
        }
        for(int i = 0; i<a; i++){
            String m = x[i];
            ln:
            if(m.length() == y.length() && !m.equals(y)){
                Map<Character , Integer> mm = new HashMap<>();
                for (char c : m.toCharArray()) {
                    mm.put(c,mm.get(c) == null?1:mm.get(c)+1);
                }
                Set<Map.Entry<Character, Integer>> entries = mm.entrySet();
                for (Map.Entry<Character, Integer> entry : entries) {
                    if (!Objects.equals(yy.get(entry.getKey()), entry.getValue())){
                        break ln;
                    }
                }
                l.add(m);
            }
        }
        l.sort(null);
        System.out.println(l.size());
        System.out.println(b > l.size() ? "":l.get(b-1));
    }
}
